home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr50 / subdoc.zip / SDSAMPLE.FRM < prev    next >
Text File  |  1993-02-04  |  2KB  |  91 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Subdoc sample project"
  4.    Height          =   6510
  5.    KeyPreview      =   -1  'True
  6.    Left            =   1035
  7.    LinkTopic       =   "Form1"
  8.    ScaleHeight     =   5820
  9.    ScaleWidth      =   7365
  10.    Top             =   1140
  11.    Width           =   7485
  12.    Begin Menu MStart 
  13.       Caption         =   "&Tile"
  14.    End
  15.    Begin Menu MFinish 
  16.       Caption         =   "&Finish"
  17.    End
  18. End
  19. DefInt A-Z
  20.  
  21. ''  This form doesn't do anything much - just a sample
  22. ''  of code for subdoc to show off with.
  23. ''  *** However try remming out the lines in MStart_Click
  24. ''      that take the loss of frame borders into account
  25. ''      and see what happens.
  26.  
  27.  
  28.  
  29. Dim T() As TILE                    ' will contain tiles
  30.  
  31. Sub MFinish_Click ()
  32.     End
  33. End Sub
  34.  
  35. Sub MStart_Click ()
  36. ''  Start the sample application:-
  37. ''      ask for name, create tiles, compute form
  38. ''      dimensions then lay out tiles.
  39. ''  *** Interesting code modification in this procedure ***
  40.  
  41. n$ = InputBox$("Please input a name", "", "Geoffrey")
  42. nc = Len(n$)
  43.  
  44.  
  45. fw = form1.Width        ' INCORRECT !!!!
  46. fh = form1.Height
  47.  
  48. '   divide form EXACTLY into NC squares each way
  49. fw = form1.Width - lostframewidthintwips()
  50. fh = form1.Height - lostframeheightintwips(True)
  51. '   rem the preceeding two lines out and see what happens
  52.  
  53.  
  54. intvlx = fw / nc         ' intervals
  55. intvly = fh / nc
  56. form1.FontSize = Tilefontsize
  57.  
  58.  
  59. ReDim T(1 To nc, 1 To nc) As TILE
  60. For r = 1 To nc
  61.     For c = 1 To nc
  62.         T(r, c).top = (r - 1) * intvly
  63.         T(r, c).left = (c - 1) * intvlx
  64.         T(r, c).bottom = (r) * intvly
  65.         T(r, c).right = (c) * intvlx
  66.         T(r, c).letter = Mid$(n$, 1 + (r + c - 2) Mod nc, 1)
  67.         T(r, c).clr = QBColor(1 + ((r + c) Mod 15))
  68.         Call showtile(r, c)
  69.     Next c
  70. Next r
  71. End Sub
  72.  
  73. Sub showtile (r, c)
  74. ''  Show the tile in the gloabl array T()
  75. ''  R and C are row and column indeces
  76. form1.DrawWidth = 1
  77. Dim ti As TILE
  78. ti = T(r, c)    ' current tile working var
  79.  
  80. Line (ti.left, ti.top)-(ti.right, ti.bottom), ti.clr, BF
  81. Line (ti.left, ti.top)-(ti.right, ti.bottom), QBColor(0), B
  82. lw = form1.TextWidth(ti.letter)
  83. lh = form1.TextHeight(ti.letter)
  84.  
  85. form1.CurrentX = (ti.left + ti.right - lw) / 2
  86. form1.CurrentY = (ti.top + ti.bottom - lh) / 2
  87. form1.Print ti.letter;
  88.  
  89. End Sub
  90.  
  91.